<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <link rel="stylesheet" href="/static/index/css/bootstrap.min.css">
        <link rel="stylesheet" href="/static/index/js/bootstrap.min.js">
        <link rel="stylesheet" href="/static/index/js/jquery-3.6.0.min.js">
        <script src="/static/sign/js/layer.js"></script>
        <script src="/static/sign/layui/layui.js"></script>
        <script src="/static/sign/js/jquery.js"></script>
        <link rel="stylesheet" href="/static/sign/layui/css/layui.css" media="all">
        <style type="text/css">
            html,body{
                width: 100%;
                height: 100%;
                margin: 0;
            }
        </style>
    </head>
<body>
<div style="margin-right: 15px">
    <!-- 内容主体区域 -->
    <div>
        当前位置：
        <span class="layui-breadcrumb" lay-separator=" > " style="visibility: visible;">
            <a href="{:url('admin/index/content')}">首页  >  </a>
            <a><cite>课程管理</cite></a>
        </span>
    </div>


    <!-- 新添信息 -->
    <button type="button" class='layui-btn layui-btn-primary newcourse' style='float: left;'>新添课程</button>


    <table class="table">
        <thead>
            <tr>
                <th scope="col">序号</th>
                <th scope="col">课程Id</th>
                <th scope="col">课程编号</th>
                <th scope="col">课程名称</th>
                <th scope="col">课程班级</th>
                <th scope="col">课程教师</th>
                <th scope="col">执行操作</th>

            </tr>
        </thead>
        <tbody>
            {volist name='course_list' id="course_list" key="k"}
                <tr>
                    <th scope="row">{$k}</th>
                    <td>{$course_list.Course_id}</td>
                    <td>{$course_list.Course_no}</td>
                    <td>{$course_list.Course_name}</td>
                    <td>{$course_list.Course_class}</td>
                    <td>{$course_list.Course_teacher}</td>

                    <td scope="row">
                        <a style="margin-right: 10px" href="{:url('admin/courseshow/coursedelete',array('id'=>$course_list.Course_id))}">删除</a>
                        <button value="{$course_list.Course_id}"  class="updToggle">修改课程</button>
                        <submit>
                    </td>
                </tr>
            {/volist}
        </tbody>
    </table>
</div>

<!-- 新添课程弹出框表单 -->
<form action="{:url('courseshow/newcourse')}" method="POST" id="form">
    <div style='display:none;width:450px;height:300px;z-index:1000;position: fixed;top: 50%;left: 50%;background-color: #fff;
        box-shadow: 2px 0px 20px 0px;margin-top: -146px;margin-left: -250px;' id='tonewcourse'>
        <div class="layui-layer-title" style='font-size: 20px; margin-left: 10px; margin-top: 10px;'>新添课程信息</div>
        <span class="layui-layer-setwin"><a class="layui-layer-ico layui-layer-close layui-layer-close1" href="javascript:;" onclick='newcourse()'></a></span>

        <div style='padding-right: 10px;padding-top: 10px'>           
            <div class='layui-form-item'>
                <label class='layui-form-label' style='width: 100px;'><span style='color:red'>*</span>课程编号</label>
                <div class='layui-input-block'>
                    <input type="text" lay-verify='title' autocomplete='off' placeholder='课程编号' class="layui-input" id="Courseno" name="Courseno" value="" >
                </div>
            </div>
            <div class='layui-form-item'>
                <label class='layui-form-label' style='width: 100px;'><span style='color:red'>*</span>课程名称</label>
                <div class='layui-input-block'>
                    <input type="text" lay-verify='title' autocomplete='off' placeholder='课程名称' class="layui-input" id="Coursename" name="Coursename" value="" >
                </div>
            </div>

            <div class='layui-form-item ' >
                <label class='layui-form-label' style='width: 100px;'><span style='color:red'>*</span>选择班级</label>
                <td class="" id="Class"> 
                    <select name="Class">
                        {volist name='classno_list' id="classno_list" key="k"}
                            <option value="{$classno_list.Class_no}">{$classno_list.Class_no}
                        {/volist}
                    </select>
                </td>
            </div>

            <div class='layui-form-item ' >
                <label class='layui-form-label' style='width: 100px;'><span style='color:red'>*</span>选择教师</label>
                <td class="" id="Teacher"> 
                    <select name="Teacher">
                        {volist name='tn_list' id="tn_list" key="k"}
                            <option value="{$tn_list.Rel_name}">{$tn_list.Rel_name}
                        {/volist}
                    </select>
                </td>
            </div>

            <button type="button" class='layui-btn layui-btn-primary newcourse' style='float: right;'>取消</button>
            <input type="submit" class='layui-btn layui-btn-normal' id="submit" name="submit" style='float: right;margin-right: 10px'  value="保存提交">
        </div>
    </div>
</form>

<!-- 修改课程信息弹出框表单 -->
<form action="{:url('courseshow/changecourse')}" method="POST" id="form">
    <div style='display:none;width:450px;height:370px;z-index:1000;position: fixed;top: 50%;left: 50%;background-color: #fff;
        box-shadow: 2px 0px 20px 0px;margin-top: -146px;margin-left: -250px;' id='update'>
        <div class="layui-layer-title" style='font-size: 20px; margin-left: 10px; margin-top: 10px;'>修改课程信息</div>
        <span class="layui-layer-setwin"><a class="layui-layer-ico layui-layer-close layui-layer-close1" href="javascript:;" onclick='updToggle()'></a></span>

        <div style='padding-right: 10px;padding-top: 10px'>
            <div class='layui-form-item'>
                <label class='layui-form-label' style='width: 100px;'><span style='color:red'>*</span>该课程id</label>
                <div class='layui-input-block'>
                    <input type="text" lay-verify='title' autocomplete='off' placeholder='当前id' class="layui-input" id="id" name="c_id" value=""  readonly >
                </div>
            </div>            
            <div class='layui-form-item'>
                <label class='layui-form-label' style='width: 100px;'><span style='color:red'>*</span>课程编号</label>
                <div class='layui-input-block'>
                    <input type="text" lay-verify='title' autocomplete='off' placeholder='需要修改的编号' class="layui-input" id="c_no" name="c_no" value="" >
                </div>
            </div>

            <div class='layui-form-item'>
                <label class='layui-form-label' style='width: 100px;'><span style='color:red'>*</span>课程名称</label>
                <div class='layui-input-block'>
                    <input type="text" lay-verify='title' autocomplete='off' placeholder='需要修改的课程名称' class="layui-input" id="c_name" name="c_name" value="" >
                </div>
            </div>

            <div class='layui-form-item ' >
                <label class='layui-form-label' style='width: 100px;'><span style='color:red'>*</span>选择班级</label>
                <td class="" id="Class"> 
                    <select name="Class">
                        {volist name='change_classno_list' id="change_classno_list" key="k"}
                            <option value="{$change_classno_list.Class_no}">{$change_classno_list.Class_no}
                        {/volist}
                    </select>
                </td>
            </div>

            <div class='layui-form-item ' >
                <label class='layui-form-label' style='width: 100px;'><span style='color:red'>*</span>选择教师</label>
                <td class="" id="Teacher"> 
                    <select name="Teacher">
                        {volist name='change_tn_list' id="change_tn_list" key="k"}
                            <option value="{$tn_list.Rel_name}">{$change_tn_list.Rel_name}
                        {/volist}
                    </select>
                </td>
            </div>

            <button type="button" class='layui-btn layui-btn-primary updToggle' style='float: right;'>取消</button>
            <input type="submit" class='layui-btn layui-btn-normal' id="submit" name="submit" style='float: right;margin-right: 10px'  value="修改">
        </div>
    </div>
</form>



<script>
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;

    });


    $('.updToggle').click(function() {
        $("#update").fadeToggle("slow")
        $("#layui-layer-shade1").fadeToggle()
        var id

        id = $(this).prop('value')
        // alert(id)
        $('#id').val(id)
    })


    $('.newcourse').click(function() {
        $("#tonewcourse").fadeToggle("slow")
        $("#layui-layer-shade1").fadeToggle()
    })

</script>

</body>
</html>